package com.example.demo.utils.AsyncServiceUtils;

import com.example.demo.mapper.AdminLoginLogMapper;
import com.example.demo.mapper.LoginLogMapper;
import com.example.demo.pojo.Admin.AdminLoginLog;
import com.example.demo.pojo.User.LoginLog;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class LoginAsyncService {
    @Resource
    private LoginLogMapper loginLogMapper;
    @Resource
    private AdminLoginLogMapper adminLoginLogMapper;

    @Async
    public void saveLoginLog(LoginLog loginLog) {
        // 异步保存登录日志的逻辑
        loginLogMapper.insert(loginLog);
    }

    @Async
    public void saveAdminLoginLog(AdminLoginLog adminLoginLog) {
        // 异步保存登录日志的逻辑
        adminLoginLogMapper.insert(adminLoginLog);
    }
}
